package server;

import java.io.Serializable;

/**
 * <h1>Class Person.</h1>
 * 
 * Represents a user in the system. It contains the name of the person and
 * his/her status.
 * It implements the Serializable interface since it is going to be sent
 * through the network.
 * 
 * @author Tomas
 * @date March 4 2009
 * 
 * @see server.Status
 */
public class Person implements Serializable{

	/**
	 * Required by the Serializable interface
	 */
	private static final long serialVersionUID = 1L;
	
	/**
	 * Person's screen name.
	 */
	protected String username = null;
	
	/**
	 * Person's status. By default, it is set to OFFLINE.
	 */
	protected Status status = Status.OFFLINE;
	
	/**
	 * Default constructor. I think this is necessary to serialize the class.
	 * Left intentionally empty.
	 */
	public Person(){
		
	}
	
	/**
	 * Initializes an instance of the class Person
	 * @param u
	 * 		Person's screen name.
	 */
	public Person(String u){
		
		username = u;
		
	}
	
	/**
	 * Sets the user's name
	 * @param u
	 * 		User's screen name.
	 */
	public void setUsername(String u){
		
		username = u;
		
	}
	
	/**
	 * Obtains the user's name
	 * @return
	 * 		String object containing the user's name
	 */
	public String getUsername(){
		
		return username;
		
	}
	
	/**
	 * Sets the user's status.
	 * 
	 * @param s
	 * 		User's status.
	 */
	public void setStatus(Status s){
		
		status = s;
		
	}
	
	/**
	 * Obtains the user's status.
	 * 
	 * @return
	 * 		User's status.
	 */
	public Status getStatus(){
		
		return status;
		
	}
}
